package com.zlkj.pro.core.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 孙铭泽
 * @date 2022/3/28
 * @time 15:46
 */
public class MapUtil {
    /**
     * 将异步通知的参数转化为Map
     */
    public static Map<String, String> toMap(Map<String, String[]> requestParams) {
        Map<String, String> params = new HashMap<>();
        for (String name : requestParams.keySet()) {
            String[] values = requestParams.get(name);
            String valueStr = "";
            for (int i = 0; i < values.length; i++) {
                valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";
            }
            params.put(name, valueStr);
        }
        return params;
    }
}
